package com.uetoken.cn.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.uetoken.cn.R;
import com.uetoken.cn.bean.ShippingAddressBean;

import java.util.List;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * @author 谢杨
 * @time 2018/9/7 17:12
 * @class 描述:收货地址适配器
 */
public class ShippingAddressAdapter extends BaseQuickAdapter<ShippingAddressBean.DataBean,BaseViewHolder> {
    public ShippingAddressAdapter(int layoutResId, @Nullable List<ShippingAddressBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ShippingAddressBean.DataBean item) {
        helper.setText(R.id.tv_item_shipping_address_receiver,String.format(mContext.getResources().getString(R.string.str_shipping_people),item.getConsigneename()));
        helper.setText(R.id.tv_item_shipping_address_phone,item.getMobileno());
        helper.setText(R.id.tv_item_shipping_address,String.format(mContext.getResources().getString(R.string.str_shipping_address),item.getAlladdress()));
        int isDefaultAddress = item.getIsdefault();
        if (isDefaultAddress==1){
            //默认收货地址
            helper.setVisible(R.id.tv_item_shipping_address_default_address,true);
        }else{
            helper.setVisible(R.id.tv_item_shipping_address_default_address,false);
        }
    }
}
